﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ControlsExercises
{
    public partial class RandomNumberGenerator : System.Web.UI.Page
    {
        private static Random rand = new Random();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void OnBtnClick(object sender, EventArgs e)
        {
            try
            {
                int low = int.Parse(this.lowBorder.Text);
                int high = int.Parse(this.topBorder.Text);
                this.result.Text = rand.Next(low,high).ToString();
            }
            catch (Exception)
            {
                this.result.Text = "Invalid input";
            }
        }
    }
}